package com.himore.api.web.service.impl;

import java.util.List;

import com.himore.api.common.core.domain.entity.SysUser;
import com.himore.api.common.utils.DateUtils;
import com.himore.api.common.utils.SecurityUtils;
import com.himore.api.web.mapper.TSelectedAwardsMapper;
import com.himore.api.web.model.TSelectedAwards;
import com.himore.api.web.service.ITSelectedAwardsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 我的奖品信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-01-14
 */
@Service
public class TSelectedAwardsServiceImpl implements ITSelectedAwardsService
{
    @Autowired
    private TSelectedAwardsMapper tSelectedAwardsMapper;

    /**
     * 查询我的奖品信息
     * 
     * @param recordId 我的奖品信息ID
     * @return 我的奖品信息
     */
    @Override
    public TSelectedAwards selectTSelectedAwardsById(Long recordId){
        return tSelectedAwardsMapper.selectTSelectedAwardsById(recordId);
    }

    /**
     * 查询我的奖品信息列表
     * 
     * @param tSelectedAwards 我的奖品信息
     * @return 我的奖品信息
     */
    @Override
    public List<TSelectedAwards> selectTSelectedAwardsList(TSelectedAwards tSelectedAwards){
        SysUser sysUser = SecurityUtils.getLoginUser().getUser();
        tSelectedAwards.setUserId(sysUser.getUserId());
        return tSelectedAwardsMapper.selectTSelectedAwardsList(tSelectedAwards);
    }

    /**
     * 新增我的奖品信息
     * 
     * @param tSelectedAwards 我的奖品信息
     * @return 结果
     */
    @Override
    public int insertTSelectedAwards(TSelectedAwards tSelectedAwards){
        tSelectedAwards.setCreateTime(DateUtils.getNowDate());
        return tSelectedAwardsMapper.insertTSelectedAwards(tSelectedAwards);
    }

    /**
     * 修改我的奖品信息
     * 
     * @param tSelectedAwards 我的奖品信息
     * @return 结果
     */
    @Override
    public int updateTSelectedAwards(TSelectedAwards tSelectedAwards){
        tSelectedAwards.setUpdateTime(DateUtils.getNowDate());
        return tSelectedAwardsMapper.updateTSelectedAwards(tSelectedAwards);
    }

    /**
     * 批量删除我的奖品信息
     * 
     * @param recordIds 需要删除的我的奖品信息ID
     * @return 结果
     */
    @Override
    public int deleteTSelectedAwardsByIds(Long[] recordIds){
        return tSelectedAwardsMapper.deleteTSelectedAwardsByIds(recordIds);
    }

    /**
     * 删除我的奖品信息信息
     * 
     * @param recordId 我的奖品信息ID
     * @return 结果
     */
    @Override
    public int deleteTSelectedAwardsById(Long recordId){
        return tSelectedAwardsMapper.deleteTSelectedAwardsById(recordId);
    }

    @Override
    public List<TSelectedAwards> selectTSelectedAwardsListByPhone(TSelectedAwards tSelectedAwards){
        return tSelectedAwardsMapper.selectTSelectedAwardsList(tSelectedAwards);
    }
}
